<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - MapField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="dpSyntaxHighlighter.css">

 </head>

<body class="yui-skin-sam">

<h1>inputEx - MapField Usage</h1>

<!-- Example 1 -->
<div class='exampleDiv'>
	<h2>Virtual Earth MapField creation</h2>
	<p>Use the following code to create a inputEx MapField for Virtual Earth.</p>
	<div class='demoContainer' id='container1'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript" cols="60" rows="5">
			var id = 'container1';
			var api = 'virtualearth';
			var elExample1 = new inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

			var elButton1 = inputEx.cn('button', null, null, "getValue");
			YAHOO.util.Event.addListener(elButton1, 'click', function() {
				alert(YAHOO.lang.JSON.stringify(elExample1.getValue()) );
			});
			YAHOO.util.Dom.get(id).appendChild(elButton1);
		</textarea>
	</div>
</div>

<!-- Example 2 -->
<div class='exampleDiv'>
	<h2>Yahoo Maps MapField creation</h2>
	<p>Use the following code to create a inputEx MapField for Yahoo Maps.</p>
	<div class='demoContainer' id='container2'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript" cols="60" rows="5">
			var id = 'container2';
			var api = 'yahoo';
			var elExample2 = new inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

			var elButton2 = inputEx.cn('button', null, null, "getValue");
			YAHOO.util.Event.addListener(elButton2, 'click', function() {
				alert( YAHOO.lang.JSON.stringify(elExample2.getValue()) );
			});
			YAHOO.util.Dom.get(id).appendChild(elButton2);
		</textarea>
	</div>
</div>

<!-- Example 3 -->
<div class='exampleDiv'>
	<h2>Google Maps MapField creation</h2>
	<p>Use the following code to create a inputEx MapField for Google Maps.</p>
	<div class='demoContainer' id='container3'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript" cols="60" rows="5">
			var id = 'container3';
			var api = 'google';
			var elExample3 = new inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

			var elButton3 = inputEx.cn('button', null, null, "getValue");
			YAHOO.util.Event.addListener(elButton3, 'click', function() {
				alert( YAHOO.lang.JSON.stringify(elExample3.getValue()) );
			});
			YAHOO.util.Dom.get(id).appendChild(elButton3);
		</textarea>
	</div>
</div>

<!-- Example 4 -->
<div class='exampleDiv'>
	<h2>Default MapField creation</h2>
	<p>
	Use the following code to create a inputEx MapField for whatever the default API is.
	We should complete this example by making buttons to change the default and store
	that in cookies.
	</p>
	<div class='demoContainer' id='container4'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript" cols="60" rows="5">
			var id = 'container4';
			var elExample4 = new inputEx.MapField({parentEl: id, name: 'mapField', width: '800px'});

			var elButton4 = inputEx.cn('button', null, null, "getValue");
			YAHOO.util.Event.addListener(elButton4, 'click', function() {
				alert( YAHOO.lang.JSON.stringify(elExample4.getValue()) );
			});
			YAHOO.util.Dom.get(id).appendChild(elButton4);
		</textarea>
	</div>
</div>

<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../lib/yui/json/json-min.js"></script>

<!-- Yahoo Maps AJAX API -->
<!--
<script type="text/javascript">
YMAPPID = 'Nk0DZDzV34FM2CIAsdRAtUgQJRSsJO7x2l5tuDBduamC_gZWkzyTEqcUJxAWjtqxs9Wnxb0-';
</script>
<script type="text/javascript" src="xhttp://us.js2.yimg.com/us.js.yimg.com/lib/map/js/api/ymapapi_3_8_0_7.js">
</script>
-->

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/fields/MapField.js"  type='text/javascript'></script>

<script>

// set up Virtual Earth as the default API
inputEx.MapFieldGlobals['api'] = 'virtualearth';

// how to set Google Maps as the default API; note the per-host API keys
inputEx.MapFieldGlobals['api'] = 'google';
inputEx.MapFieldGlobals['api_key'] = {
	'localhost' : 'ABQIAAAADeqGsYygYHMVWXMDJEowhBRA0pJg_vyJNqxN8QciTwW1nvTY9xTHCJ6F7R04FjG06dKgcV5wpIxzZQ',
	'code.davidjanes.com' : 'ABQIAAAADeqGsYygYHMVWXMDJEowhBRA0pJg_vyJNqxN8QciTwW1nvTY9xTHCJ6F7R04FjG06dKgcV5wpIxzZQ',
	'javascript.neyric.com' : ''
}

// how to set up Yahoo Maps as the default API
inputEx.MapFieldGlobals['api'] = 'yahoo';
inputEx.MapFieldGlobals['Nk0DZDzV34FM2CIAsdRAtUgQJRSsJO7x2l5tuDBduamC_gZWkzyTEqcUJxAWjtqxs9Wnxb0-'] = 'yahoo';

</script>

<!-- inputEx examples -->
<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>

 </body>
</html>
